package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 *
 * 用户的支付账号信息：
 * 账号：devcny0992@sandbox.com
 * 登录密码：111111
 * 支付密码：111111
 *
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id ="2016091400508556";

    // 商户私钥，您的APKCS8格式RS2私钥
    public static String merchant_private_key ="MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCL+pNPgI21JoYI2kUEQmQaDGJO0Jaxz5FZocllTMNH6p1A6MabUeoxztqpVQUwc4q7xL0f2U4VoFWWfMkbJkhzOj27EPgRKf1i9GK9ZMV1uyOWht/kJ8JC18Z32Jybtq3Tih8FzO/uMAVkLwQgTjeeFxFyAQM6MrtbRPS7wvbFxoOeAy0gfvu452/YejVhiGO9+AsY+aYbXPxQMciyhvRkqNBH7ZOXh6hdLTVJpwXTcCSPb8ZCKrlzbOieZdM+SOkMHa0LLmpYQHZVGrCWHTp0D3PXMcvLNZoVF7HBddfJyAfg2yShvct756Nrlbmuwe1lXE6khBpVmQlPGCI/dFvtAgMBAAECggEACF9kkEzQLRWwzra/ihGuiyBSgQRY/ym7N/FFapm81IBkB43k00WDDJei3J4JQWynz7Nk3JLS6Ng+RlIQdV9E1h+VsarCK8SnM1QK0+lDJlebOVW37p2yMO1XIbQDKg0zOIP6dw5bC5QzvlpRlN0Y1ovqrzcASmreagcl3FU9DXdKygHtZgLYj5KzwaG99xXLd7NlNBjVpZmumDK6RF1hihEtMEcmyf2CvKYk0bSmN1LxqD9bbxyS2oj9MBDW19gnsm0WihESX52jCYjYSPjWV0ydOd+uhbOgmt6N162YjWbf6dtcGNeEgbS2XPdi5kzBMrg4PpUp8QaHzlfXDlsgwQKBgQD4oIDrDqsxwpL/vlJE50WNwbRs8C8n4UP3474YNZIMTFNG0UqFfSA1l6PEPwl8Y8gHtRwo1LZqTk3WOiPy5w9uiZo91YHfD1vwEyiDuGcLMbAu6qnlM1l4HJGO65tjjE5PR6j80hTmXt+JYkiEwQSCH1BxwnIetc6qWn+JwxgO3wKBgQCQIT/yI5MZN2xAzHl3vOOVXYOPCp34lQw0Xbyr2GiBNWn2Ca8h4bLlDAKNyTaemNq55syVKxpR0MGSUp93SKlQBduqTTWofzoIZslOLyPxmfNZZfDjG2BsQbjEYzZj2TPjZDb9vakRcRD6lGuEffValu7vPzxEXOLfKN000NrKswKBgQDDo/kN/iL0KvnlSGwQUDRJEe3Z8z4IEZicTZdeEXl1N/InvbT4Sbe4tDRnznq2aQYUGo2oC4nnKOrS8jkrgGqCPsEiewmQ7tMXnNu6mrZq9pR+tqUt+DQk8cYQQpGpydQtSmRNXTqY9HrN7orF++SCSAXTHoESbVnMbx4A14Xs3QKBgQCHsHXmPW2oCNCGdLpKau8LWL2ZdhJgy9lwl2sfkZ5ZPnMiad2SFUz5bAQfffZI+3i4GbwzFyAxNEp4ugZdI3Aa4Vj7jLLejeCRtksAq0q4kwpR+LH+7XAqmvkbEphLClpaUqee3OaFgB/O+Nn8IyVRAtWxMaRIa/Y+x9bxeUryFwKBgDweQZMYf4HWf4JcObZ7z4ysTNXkf9M8BP4GQ4UfKjNSalO9eMisUi+dtS2PPqmeHiBotTTc9h+PruV4E3bIt93FOopkIMrueEygLmj0Dpy0LICVnjXBJw4IkhxW4HopKFLtunlVn5b8s3FucAr+4SC3QSLe4Q9wincL5Lm3XiqL";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key ="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArsGrXfEEBvR/2QlZM3ZVJe52Y4Db3A30DjMEbV16FKqGDwgJtFCXDuKUdYLQHhA27I/CgGA9pI7zvSQRImUrQPh30TF4GW8MLJLfQoTTEKGaYss38KzqjgF0LCyh7Xu29mvk+VR+5E/GtqRLtHS7TIFBOmIgsssKyKcof0AXNMtaHbXzyXVY0Zdxa+K2xwbuwEKD4Zqb3FIDgl2/mZIFslOi8MsfYqObbNdDJavc2fqP3RYd0eLEio3rLv/3nZVO6EhTeQBjG6nrApGo7oxGMkeZqaZyiwKMdDYYo40Oxv8XUXH6TGD3wDUqsZLXaBTwqWb+zeUO6wLTB5YcfCepUwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "https://2a0820x628.goho.co/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "https://2a0820x628.goho.co/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

